import java.util.Arrays;
import java.util.Scanner;
//移动零
public class Demo1 {
    public static void main(String[] args) {
        int[]nums=new int[5];
        for (int i = 0; i < nums.length; i++) {
            Scanner scanner=new Scanner(System.in);
            nums[i]=scanner.nextInt();
            //为数组赋值0 ，1 ，0，3，12
        }
        int cur=0;
        int dest=-1;
        for (int i = 0; i < nums.length; i++) {
            if(nums[i]==0){
                cur++;
            }else{
                dest++;
                int imp=nums[dest];
                nums[dest]=nums[cur];
                nums[cur]=imp;
                cur++;
            }
        }
        System.out.println(Arrays.toString(nums));
    }
}
